<!DOCTYPE html>
<html>

	<head>
		<!-- 页面meta -->
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">

		<title>数据后台管理-订单管理</title>

		<!-- Tell the browser to be responsive to screen width -->
		<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">

		<!-- 页面meta /-->

		<link rel="stylesheet" href="../plugins/bootstrap/css/bootstrap.min.css">
		<link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
		<link rel="stylesheet" href="../plugins/ionicons/css/ionicons.min.css">
		<link rel="stylesheet" href="../plugins/iCheck/square/blue.css">
		<link rel="stylesheet" href="../plugins/morris/morris.css">
		<link rel="stylesheet" href="../plugins/jvectormap/jquery-jvectormap-1.2.2.css">
		<link rel="stylesheet" href="../plugins/datepicker/datepicker3.css">
		<link rel="stylesheet" href="../plugins/daterangepicker/daterangepicker.css">
		<link rel="stylesheet" href="../plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
		<link rel="stylesheet" href="../plugins/datatables/dataTables.bootstrap.css">
		<link rel="stylesheet" href="../plugins/treeTable/jquery.treetable.css">
		<link rel="stylesheet" href="../plugins/treeTable/jquery.treetable.theme.default.css">
		<link rel="stylesheet" href="../plugins/select2/select2.css">
		<link rel="stylesheet" href="../plugins/colorpicker/bootstrap-colorpicker.min.css">
		<link rel="stylesheet" href="../plugins/bootstrap-markdown/css/bootstrap-markdown.min.css">
		<link rel="stylesheet" href="../plugins/adminLTE/css/AdminLTE.css">
		<link rel="stylesheet" href="../plugins/adminLTE/css/skins/_all-skins.min.css">
		<link rel="stylesheet" href="../css/style.css">
		<link rel="stylesheet" href="../plugins/ionslider/ion.rangeSlider.css">
		<link rel="stylesheet" href="../plugins/ionslider/ion.rangeSlider.skinNice.css">
		<link rel="stylesheet" href="../plugins/bootstrap-slider/slider.css">
		<link rel="stylesheet" href="../plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.css">
	</head>

	<body class="hold-transition skin-purple sidebar-mini">

		<div id="app">
			<div class="wrapper">

				<!-- 页面头部 -->
				<div id="header"></div>
				<!-- 页面头部 /-->

				<!-- 导航侧栏 -->
				<div id="sidebar"></div>
				<!-- 导航侧栏 /-->

				<!-- 内容区域 -->
				<!-- @@master = admin-layout.html-->
				<!-- @@block = content -->

				<div class="content-wrapper">

					<!-- 内容头部 -->
					<section class="content-header">
						<h1>
							订单管理
							<small>订单详情</small>
						</h1>
						<ol class="breadcrumb">
							<li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
							<li><a href="#">订单管理</a></li>
							<li class="active">订单详情</li>
						</ol>
					</section>
					<!-- 内容头部 /-->

					<!-- 正文区域 -->
					<section class="content">
						<!--订单信息-->
						<div class="panel panel-default" id="order-tab-label">
							<div class="panel-heading">订单信息</div>

							<div class="row data-type">

								<div class="col-md-2 title">订单编号</div>
								<div class="col-md-4 data text">
									<input type="text" class="form-control" value="" readonly="readonly" v-model="order.orderNum">
								</div>

								<div class="col-md-2 title">下单时间</div>
								<div class="col-md-4 data text">
									<div class="input-group date">
										<div class="input-group-addon">
											<i class="fa fa-calendar"></i>
										</div>
										<input type="text" class="form-control pull-right" v-show="readState" id="dateTimePicker" v-model="order.orderTimeStr" >
										<input type="text" class="form-control pull-right" v-show="!readState"  v-model="order.orderTimeStr" readonly>
									</div>
								</div>

								<div class="col-md-2 title">路线名称</div>
								<div class="col-md-4 data text">
									<input type="text" class="form-control"  readonly="readonly" v-model="order.product.productName" >
								</div>

								<div class="col-md-2 title">出发城市</div>
								<div class="col-md-4 data text">
									<input type="text" class="form-control" readonly="readonly" v-model="order.product.cityName" src="">
								</div>

								<div class="col-md-2 title">出发时间</div>
								<div class="col-md-4 data text">
									<div class="input-group date">
										<div class="input-group-addon">
											<i class="fa fa-calendar"></i>
										</div>
										<input type="text" class="form-control pull-right" id="datepicker" v-model="order.product.departureTimeStr" readonly>
									</div>
								</div>
								<div class="col-md-2 title">出游人数</div>
								<div class="col-md-4 data text">
									<input type="text" class="form-control" value="" readonly="readonly" v-model="order.peopleCount">
								</div>

								<div class="col-md-2 title rowHeight2x">其他信息</div>
								<div class="col-md-10 data rowHeight2x">
									<textarea class="form-control" rows="3" v-model="order.orderDesc" :readonly="readState?false:'readonly'"></textarea>
								</div>

							</div>

						</div>
						<!--订单信息/-->

						<!--游客信息-->
						<div class="panel panel-default" id="travellers-tab-label">
							<div class="panel-heading">游客信息</div>
							<!--数据列表-->
							<table id="dataList" class="table table-bordered table-striped table-hover dataTable">
								<thead>
								<tr >
									<th class="">人群</th>
									<th class="">姓名</th>
									<th class="">性别</th>
									<th class="">手机号码</th>
									<th class="">证件类型</th>
									<th class="">证件号码</th>
									<th class="">操作</th>
								</tr>
								</thead>
								<tbody>

								<tr v-for="(traveller,index) in order.travellers">
<!--									<td>{{traveller.travellerTypeStr}}</td>-->
									<td>
										<input type="text" class="form-control" v-show="!readState" readonly v-model="traveller.travellerTypeStr"/>
										<select class="form-control" v-show="readState" v-model="traveller.travellerTypeStr">
										<option>成人</option>
										<option>儿童</option>
										</select>
									</td>
									<td>
										<input type="text" class="form-control" size="10" value="姓名" v-model="traveller.name" :readonly="readState?false:'readonly'">

									</td>
									<td>
										<input type="text" class="form-control" v-show="!readState" readonly v-model="traveller.sex"/>
										<select class="form-control" style="height:32px " v-model="traveller.sex" v-show="readState">
											<option selected>男</option>
											<option >女</option>
										</select>
									</td>
									<td><input type="text" size="20" v-model="traveller.phoneNum" class="form-control" :readonly="readState?false:'readonly'"></td>
<!--									<td><input type="text" size="15" v-model="traveller.credentialsTypeStr"></td>-->
									<td>
										<input type="text" class="form-control" v-show="!readState" readonly v-model="traveller.sex" v-model="traveller.credentialsTypeStr"/>
										<select class="form-control" v-show="readState" v-model="traveller.credentialsTypeStr">
										<option>身份证</option>
										<option>护照</option>
										<option>军官证</option>
										<option>其他</option>
										</select>
									</td>
									<td><input type="text" size="38" v-model="traveller.credentialsNum" class="form-control" :readonly="readState?false:'readonly'"></td>
									<td><button type="button" class="btn bg-olive btn-xs" @click="delTraveller(index)" v-show="readState">删除</button></td>
								</tr>

								</tbody>
								<tfoot v-show="readState">
								<tr>
									<td colspan="7">
										<div class="box-tools text-center">
											<button type="button" id="addTraveller_btn" class="btn bg-maroon" @click="addTraveller">新增游客</button>
										</div>
									</td>
								</tr>
								</tfoot>
							</table>
							<!--数据列表/-->
						</div>

						<!--游客信息/-->

						<!--联系人信息-->
						<div class="panel panel-default" id="contact-tab-label">
							<div class="panel-heading">联系人信息</div>

							<div class="row data-type">

								<div class="col-md-2 title">会员</div>
								<div class="col-md-4 data text">
									<input type="text" class="form-control" v-model="order.member.nickname" class="form-control" :readonly="readState?false:'readonly'">
								</div>

								<div class="col-md-2 title">联系人</div>
								<div class="col-md-4 data text">
									<input type="text" class="form-control" v-model="order.member.name" class="form-control" :readonly="readState?false:'readonly'">
								</div>

								<div class="col-md-2 title">手机号</div>
								<div class="col-md-4 data text">
									<input type="text" class="form-control" v-model="order.member.phoneNum" class="form-control" :readonly="readState?false:'readonly'">
								</div>

								<div class="col-md-2 title">邮箱</div>
								<div class="col-md-4 data">
									<input type="text" class="form-control" v-model="order.member.email" class="form-control" :readonly="readState?false:'readonly'">
								</div>

							</div>

						</div>
						<!--联系人信息/-->

						<!--费用信息-->
						<div class="panel panel-default" id="money-tab-label">
							<div class="panel-heading">费用信息</div>

							<div class="row data-type">

								<div class="col-md-2 title">支付方式</div>
								<div class="col-md-4 data text">
									<input type="text" class="form-control" v-model="order.payTypeStr" readonly v-show="!readState">
									<select class="form-control" v-model="order.payTypeStr" v-show="readState">
										<option>微信</option>
										<option>支付宝</option>
										<option>其他</option>
									</select>
								</div>

								<div class="col-md-2 title">金额</div>
								<div class="col-md-4 data text">
									<input type="text" class="form-control" v-model="order.product.productPrice" class="form-control" :readonly="readState?false:'readonly'">
								</div>

							</div>

						</div>
						<!--费用信息/-->

						<div class="box-tools text-center">
							<button type="button" id="submit_btn" class="btn bg-maroon" @click="submit">修改</button>
							<button type="button" class="btn bg-default" @click="goToList">返回</button>
						</div>

					</section>
					<!-- 正文区域 /-->

				</div>
				<!-- @@close -->
				<!-- 内容区域 /-->


				<!-- 底部导航 -->
				<div id="footer"></div>
				<!-- 底部导航 /-->

			</div>
		</div>


		<script src="../plugins/jQuery/jquery-2.2.3.min.js"></script>
		<script src="../plugins/jQueryUI/jquery-ui.min.js"></script>
		<script src="../js/include.js"></script>
		<script>
			$.widget.bridge('uibutton', $.ui.button);
		</script>
		<script src="../plugins/bootstrap/js/bootstrap.min.js"></script>
		<script src="../plugins/raphael/raphael-min.js"></script>
		<script src="../plugins/morris/morris.min.js"></script>
		<script src="../plugins/sparkline/jquery.sparkline.min.js"></script>
		<script src="../plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
		<script src="../plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
		<script src="../plugins/knob/jquery.knob.js"></script>
		<script src="../plugins/daterangepicker/moment.min.js"></script>
		<script src="../plugins/daterangepicker/daterangepicker.js"></script>
		<script src="../plugins/daterangepicker/daterangepicker.zh-CN.js"></script>
		<script src="../plugins/datepicker/bootstrap-datepicker.js"></script>
		<script src="../plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
		<script src="../plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
		<script src="../plugins/slimScroll/jquery.slimscroll.min.js"></script>
		<script src="../plugins/fastclick/fastclick.js"></script>
		<script src="../plugins/iCheck/icheck.min.js"></script>
		<script src="../plugins/adminLTE/js/app.min.js"></script>
		<script src="../plugins/treeTable/jquery.treetable.js"></script>
		<script src="../plugins/select2/select2.full.min.js"></script>
		<script src="../plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
		<script src="../plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.zh-CN.js"></script>
		<script src="../plugins/bootstrap-markdown/js/bootstrap-markdown.js"></script>
		<script src="../plugins/bootstrap-markdown/locale/bootstrap-markdown.zh.js"></script>
		<script src="../plugins/bootstrap-markdown/js/markdown.js"></script>
		<script src="../plugins/bootstrap-markdown/js/to-markdown.js"></script>
		<script src="../plugins/ckeditor/ckeditor.js"></script>
		<script src="../plugins/input-mask/jquery.inputmask.js"></script>
		<script src="../plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
		<script src="../plugins/input-mask/jquery.inputmask.extensions.js"></script>
		<script src="../plugins/datatables/jquery.dataTables.min.js"></script>
		<script src="../plugins/datatables/dataTables.bootstrap.min.js"></script>
		<script src="../plugins/chartjs/Chart.min.js"></script>
		<script src="../plugins/flot/jquery.flot.min.js"></script>
		<script src="../plugins/flot/jquery.flot.resize.min.js"></script>
		<script src="../plugins/flot/jquery.flot.pie.min.js"></script>
		<script src="../plugins/flot/jquery.flot.categories.min.js"></script>
		<script src="../plugins/ionslider/ion.rangeSlider.min.js"></script>
		<script src="../plugins/bootstrap-slider/bootstrap-slider.js"></script>
		<script src="../plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.js"></script>
		<script src="../plugins/bootstrap-datetimepicker/locales/bootstrap-datetimepicker.zh-CN.js"></script>
		<script>
			// 设置激活菜单
			function setSidebarActive(tagUri) {
				var liObj = $("#" + tagUri);
				if (liObj.length > 0) {
					liObj.parent().parent().addClass("active");
					liObj.addClass("active");
				}
			}

			$(document).ready(function() {
				$('#datepicker').datetimepicker({
					format: "yyyy-mm-dd hh:ii:ss",
					autoclose: true,
					todayBtn: true,
					language: 'zh-CN'
				});

				// datetime picker
				$('#dateTimePicker').datetimepicker({
					format: "yyyy-mm-dd hh:ii:ss",
					autoclose: true,
					todayBtn: true,
					language: 'zh-CN'
				});
				// 激活导航位置
				setSidebarActive("order-manager");


			});
		</script>
	<script src="../js/config.js"></script>
	<script src="../js/getParameter.js"></script>
	<script>
		$(function () {
			$("#dateTimePicker").datetimepicker().on("changeDate",function () {
				app.order.orderTime = $("#dateTimePicker").val();
			})
			$("#datepicker").datetimepicker().on("changeDate",function () {
				app.order.product.departureTime = $("#datepicker").val();
			})

		})
		const app = new Vue({
			el:"#app",
			data:{
				order:{
				},
				readState:0
			},
			methods:{
				loadOrder(){
					let id = getParameter("id");
					if (id==null){
						location.href="404.html"
					}else{
						this.order.id = id;
						axios.get(getServerUrl("order/find/"+id)).then(function (res) {
							app.order=res.data;
						})
					}
				},
				submit(){
					if (this.readState===0){
						this.readState = 1;
						$("#submit_btn").html("提交")
					}else{
						for (let i = 0; i < this.order.travellers.length; i++) {
							if (JSON.stringify(this.order.travellers[i])==='{}'){
								this.order.travellers.splice(i,1)
								i--;
							}
						}
						axios.put(getServerUrl("order/update"),{
							order:app.order
						}).then(function (res) {
							if (res.data){
								alert("修改成功")
							}else{
								alert("修改失败")
							}
							app.loadOrder()
							app.readState = 0;
							$("#submit_btn").html("修改")
						})

					}
				},
				goToList(){
					location.href="/pages/order-list.html"
				},
				addTraveller(){
					this.order.travellers.push({})
				},
				delTraveller(index){
					this.order.travellers.splice(index,1)
				}
			},
			created(){
				this.loadOrder();
			}
		})
	</script>
	</body>

</html>
<!---->
